//
//  MMGBaseViewController.swift
//  MyMicroblog
//
//  Created by Mac on 17/1/4.
//  Copyright © 2017年 itcast. All rights reserved.
//

import UIKit

public let bigImageWH:CGFloat = 100
class MMGBaseViewController: UIViewController, MMGVisitorViewDelegate {
    
    var userLogin: Bool = false
    
    let visitorView:MMGVisitorView = MMGVisitorView()

    override func viewDidLoad() {
        
        if MMGUserAccountViewModel.shared.userLogin {
            super.viewDidLoad()
            view.backgroundColor = UIColor.white
        }else{
        
            view = visitorView
            visitorView.delegate = self
        }
    }
}


// 分类中实现代理方法
extension MMGBaseViewController {
    // 实现用户登录
    func userWillLogin() {
        
        let oauthCtr:MMGOAuthViewController = MMGOAuthViewController()
        let navi:MMGNavigationController = MMGNavigationController(rootViewController: oauthCtr)
        
        self.navigationController?.present(navi, animated: true, completion: nil)
    }
}
